home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.0 / Video Toaster v4.0.iso / arexx / cg / saveattrib.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-10  |  3KB  |  87 lines

  1. /* SaveAttrib -- Save current char settings to rexx macro */
  2. /* By Bob Caron ©1994 NewTek, Inc.                        */
  3.  
  4. filnam = 'ENV:SaveAttrib.state'
  5. version = 'SaveAttrib v1.4'
  6.  
  7. if (exists(filnam)) then do
  8.     if (~open(state, filnam, 'R')) then break
  9.     if (readln(state) ~= version) then break
  10.     file=readln(state)
  11.     end
  12.     call close state
  13.  
  14. if file="FILE" | file="" then
  15.    file="Toaster:Arexx/CG/AttribScripts/AttribSet.rexx"
  16.  
  17. if lastpos('/',file,length(file)-1)~=0 then do
  18.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  19.    path=left(file,(lastpos('/',file,length(file))-1))
  20.    end
  21. else do
  22.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  23.    path=left(file,(lastpos(':',file,length(file))))
  24.    end
  25.  
  26. call addlib(CG_AREXX,0)
  27. outfile=REQ_FILE("Save Character Attributes As...",filenam,path)
  28.  
  29. if outfile="" then
  30.    exit
  31.  
  32. file=script
  33. if (open(state, filnam, 'W')) then do
  34.     call writeln state, version
  35.     call writeln state, outfile
  36.     call close state
  37. end
  38.  
  39. if exists(outfile) then do
  40.    x=req_ask("Write Over File '"||outfile||"'?")
  41.    if x=0 then do
  42.       x=req_tell("Canceled")
  43.       end
  44.    end
  45.  
  46. stype=0
  47. if (~open(outfd,outfile,W)) then
  48.      call REQ_TELL("Can't open output:",outfile)
  49.  
  50.    bordbotr=translate(GET_BORD(BOTR),","," ")
  51.    charrgba=translate(GET_CHAR(RGBA),","," ")
  52.    charbotr=translate(GET_CHAR(BOTR),","," ")
  53.    shadrgba=translate(GET_SHAD(TOPR),","," ")
  54.    bordrgba=translate(GET_BORD(TOPR),","," ")
  55.    bordprio=GET_BORD(PRIO)
  56.    if get_shad(PRIO)=0 then prio="B"
  57.       else prio="T"
  58.    if get_shad(type)="None" then stype=0
  59.    if get_shad(type)="Cast" then stype=2
  60.    if get_shad(type)="Drop" then stype=1
  61.  
  62.    writeln(outfd,"/* "||outfile" -- An Attribute Setter   */")
  63.    writeln(outfd,"/* By A. Random User ©1994 NewTek, Inc. */")
  64.    writeln(outfd,"/* (Based on a program by Bob Caron.)   */")
  65.    writeln(outfd,"")
  66.    writeln(outfd,"call addlib(CG_AREXX,0)")
  67.    writeln(outfd,"")
  68.    writeln(outfd,"CALL SET_CHAR(FILL,'"||get_char(fill)||"')")
  69.    writeln(outfd,"CALL SET_CHAR(BOTR,"||charbotr||")")
  70.    writeln(outfd,"CALL SET_CHAR(RGBA,"||charrgba||")")
  71.    writeln(outfd,"CALL SET_BORD(FILL,'"||get_bord(fill)||"')")
  72.    writeln(outfd,"CALL SET_BORD(BOTR,"||bordbotr||")")
  73.    writeln(outfd,"CALL SET_BORD(SIZE,"||left(get_bord(SIZE),1)||")")
  74.    writeln(outfd,"CALL SET_BORD(PRIO,"||bordprio||")")
  75.    writeln(outfd,"CALL SET_BORD(TOPR,"||bordrgba||")")
  76.    writeln(outfd,"CALL SET_SHAD(TYPE,"||stype||")")
  77.    writeln(outfd,"CALL SET_SHAD(SPOT,"||get_shad(SPOT)||")")
  78.    writeln(outfd,"CALL SET_SHAD(PRIO,"||prio||")")
  79.    writeln(outfd,"CALL SET_SHAD(SIZE,"||get_shad(SIZE)||")")
  80.    writeln(outfd,"CALL SET_SHAD(TOPR,"||shadrgba||")")
  81.  
  82.    call close(outfd)
  83.    call REQ_TELL("Saved...")
  84.    call REMLIB(CG_AREXX)
  85. exit
  86.  
  87.